<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class EmailSiteStateNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $site;
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($site)
    {
        //
        $this->site = $site;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        $url = url('/siteinfo-'.$this->site->id.'.html');
        return (new MailMessage)
            ->greeting($notifiable->name.'您好：')
            ->subject($this->site->url.'审核成功，请进行查看 - 秀站网')
            ->line('请点击下方链接进行查看')
            ->action('查看', $url);
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}
